package com.ruoyi.system.mapper;

import com.ruoyi.system.domain.ReportRuleTask;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 报告任务规则Mapper接口
 * 
 * @author ruoyi
 * @date 2021-09-23
 */
public interface ReportRuleTaskMapper 
{
    /**
     * 查询报告任务规则
     * 
     * @param id 报告任务规则ID
     * @return 报告任务规则
     */
    public ReportRuleTask selectReportRuleTaskById(Long id);

    /**
     * 查询报告任务规则列表
     * 
     * @param reportRuleTask 报告任务规则
     * @return 报告任务规则集合
     */
    public List<ReportRuleTask> selectReportRuleTaskList(ReportRuleTask reportRuleTask);

    /**
     * 新增报告任务规则
     * 
     * @param reportRuleTask 报告任务规则
     * @return 结果
     */
    public int insertReportRuleTask(ReportRuleTask reportRuleTask);

    /**
     * 修改报告任务规则
     * 
     * @param reportRuleTask 报告任务规则
     * @return 结果
     */
    public int updateReportRuleTask(ReportRuleTask reportRuleTask);

    /**
     * 删除报告任务规则
     * 
     * @param id 报告任务规则ID
     * @return 结果
     */
    public int deleteReportRuleTaskById(Long id);

    /**
     * 批量删除报告任务规则
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteReportRuleTaskByIds(Long[] ids);


    @Select("<script>" +
            "SELECT * from report_rule_task " +
            "WHERE " +
            "id in " +
            "<foreach collection = 'ids' item ='id' index ='index' open='(' close=')' separator=','>#{id}</foreach></script>"
    )
    @Results({
            @Result(column = "target_id", property = "targetId"),
            @Result(column = "target_type", property = "targetType"),
            @Result(column = "task_id", property = "taskId"),
            @Result(column = "template_id", property = "templateId"),
    })
    List<ReportRuleTask> selectReportRuleTaskByIds(@Param("ids") Long[] ids);
}
